package com.agileboot.attendance.domain.settlement.dto;

import com.agileboot.attendance.domain.settlement.entity.AttSettlementDetailEntity;
import com.agileboot.common.utils.bean.BeanCopyUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 结算单明细DTO
 */
@Data
@ApiModel("结算单明细信息")
public class SettlementBillDetailDTO {

    @ApiModelProperty(value = "明细ID")
    private Long id;

    @ApiModelProperty(value = "结算单ID")
    private Long settlementId;

    @ApiModelProperty(value = "人员ID")
    private Long personnelId;

    @ApiModelProperty(value = "人员姓名")
    private String personnelName;

    @ApiModelProperty(value = "出勤天数")
    private Integer attendanceDays;

    @ApiModelProperty(value = "加班时长（小时）")
    private BigDecimal overtimeHours;
    
    @ApiModelProperty(value = "月薪")
    private BigDecimal monthlyRate;

    @ApiModelProperty(value = "日薪")
    private BigDecimal dailyRate;

    @ApiModelProperty(value = "加班费率")
    private BigDecimal overtimeRate;

    @ApiModelProperty(value = "出勤金额")
    private BigDecimal attendanceAmount;

    @ApiModelProperty(value = "加班金额")
    private BigDecimal overtimeAmount;

    @ApiModelProperty(value = "结算总金额")
    private BigDecimal totalAmount;

    @ApiModelProperty(value = "备注")
    private String remark;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    /**
     * 通过实体类构建DTO
     */
    public static SettlementBillDetailDTO fromEntity(AttSettlementDetailEntity entity) {
        if (entity == null) {
            return null;
        }
        SettlementBillDetailDTO dto = BeanCopyUtils.copy(entity, SettlementBillDetailDTO.class);
        dto.setId(entity.getId());
        return dto;
    }
} 